using UnityEngine;
using UnityEngine.UI;

public class ChapterCities : MonoBehaviour
{
	public Image title;

	public Image image;

	public Text text;

	public Text process;

	public GameObject lockMask;

	public int chapter;

	private RectTransform m_Trans;

	[SerializeField]
	private float m_Scale;

	private Vector3 m_ScaleVector;

	[SerializeField]
	[Range(0.001f, 7f)]
	private float m_Distance;

	[SerializeField]
	private ScrollRect m_ScrollRect;

	[SerializeField]
	private float m_ScaleThreshold;

	private void Awake()
	{
		m_Trans = (base.transform as RectTransform);
		m_ScaleVector = Vector3.one * m_Scale;
		m_ScaleVector.z = 1f;
		m_ScrollRect.onValueChanged.AddListener(OnScrollValueChange);
	}

	private void OnDestroy()
	{
		m_ScrollRect.onValueChanged.RemoveListener(OnScrollValueChange);
	}

	public void OnScrollValueChange(Vector2 value)
	{
		RectTransform trans = m_Trans;
		Vector3 scaleVector = m_ScaleVector;
		Vector3 one = Vector3.one;
		Vector3 position = m_Trans.position;
		trans.localScale = Vector3.Lerp(scaleVector, one, Mathf.Abs(position.x / m_Distance));
	}

	public void OnMaskClick()
	{
		LayoutInfoKey layoutInfoKey = new LayoutInfoKey();
		layoutInfoKey.Chapter = chapter;
		layoutInfoKey.Level = 1;
		LayoutInfoKey key = layoutInfoKey;
		int openStar = LayoutConfiguration.cardDictionary[key].OpenStar;
		int num = openStar - ConstantData.missionRecords.GetTotalStar();
		string text = string.Format(HOLocalizationConfiguration.GetValue(205), num);
		TopBarTip.Show(text);
	}
}
